﻿<!doctype html>
<html lang="zh">
<head>
	<title>大忽悠聊天室</title>

	<!-- Meta-Tags -->
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">

	<!-- style CSS -->
	<link rel="stylesheet" href="../css/style.css" type="text/css" media="all">
	<!-- google fonts -->
	<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;500;700&display=swap" rel="stylesheet">
</head>
<body>
<section class="main">
	<div class="logo text-center">
		<h1> <a href="index.html">大忽悠盲盒聊天室</a></h1>
	</div>
	<div class="content-w3ls text-center">
		<img src="../images/admin.png" alt="" class="img-responsive">
		<form>
			<div class="wthree-field">
				<input name="name" id="text1" type="text" placeholder="用户名" required>
			</div>
			<div class="wthree-field">
				<input name="pwd" id="myInput" type="Password" placeholder="密码" required>
			</div>
			<div class="wthree-field">
				<button id="login-button" type="submit" class="btn">登录</button>
			</div>
			<div class="login-bottom">
				<a href="#url" class="">创建账户</a>
			</div>
		</form>
	</div>
	<div class="copyright">
		<p>大忽悠工作室</p>
	</div>
</section>


<script src="js/jquery-2.1.1.min.js" type="text/javascript"></script>
<script>
$('#login-button').click(function (event) {
   //ajax发送异步登录请求
	$.ajax({
		url:"login",
		type:"get",
		data:$("form").serialize(),
		success:function (res)
		{
			if(res.flag)
			{
				//跳转到main.html页面
				location.href="toMainPage";
			}
			else
			{
				alert(res.message);
			}
		}
	})
	//阻止表单的默认提交行为
	return false;
});
</script>
</div>
</body>
</html>